


**** The following do file replicates the results for Figure 1 and Table 3

*** Variable description
* prefer_male2 = 1 if respondent prefers man for position; 0 if prefer woman or has no preference
* prefer_male = 1 if respondent prefers man for position;  no preference; -1 if prefer woman
* connected =1 if respondent prefers candidate with transparency quality over honesty quality
* d611ba2b11_id is tripartite variable that is 1 if the randomized trait from Table 2 is Connection; 2 if Knows how system works; 3 if Respected by other government officials
* Kinh =1 if respondent is from majority kinh ethnic group (0 if minority)
* female = 1 if respondent is a woman
* age is respondent's age
* khuvuc  is 1 if respondent is from urban area; 2 if from rural
* income_pc is a six category variable corresponding to 6 percentile groups of income
* education_pc is a four category variable corresponding to 4 quartiles of education_pc
* papi_head_gender is 1 if the village leader is a man and 2 if the respondent's village leader is a woman 
* trad_val is an additive index of traditional values ranging from 0-3
* positions_common refers to the level of government for the position under question: 1 for legislative; 2 for meso executive and 3 for prime minister. THis analysis is limited to legislative offices

clear all
set more off
set mem 500m
set matsize 800
clear all

cap cd "Set Directory" 
log using gender_clientelism, replace

* This dataset contains the survey data from the 2020 wave of PAPI
use Schuler_GenderAndClientelism_Replication1, replace /* This dataset contains the relevant variables from the 2020 PAPI survey*/

svyset, clear

* This code sets the survey weights. The PSW_psweight_opt1 sets te respondent weights; other units adjust the standard errors for the clustered nature of the design. The post stratification weights account for the differences in provincial populations
svyset PSW_PSU [pweight=PSW_psweight_opt1], fpc(PSW_FPC1) strata(PSW_STRATA) singleunit(certainty) ///
 || PSW_SSU, fpc(PSW_FPC2) strata(PSW_STRATA2) || villageid, fpc(PSW_FPC3) strata(PSW_STRATA3) ///
 || _n,  poststrata(tinh)  postweight(PSW_province_population)
 

svy: reg prefer_male2 connected kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val if positions_common==1
estimates store y2020
outreg2 using client_main_rep, e(all) replace

svy: reg prefer_male2 i.connect1 kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val  if d611ba2b11_id==1 & positions_common==1
outreg2 using client_main_rep, e(all) 

svy: reg prefer_male2 i.connect2 kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val  if d611ba2b11_id==2 & positions_common==1
outreg2 using client_main_rep, e(all) 

svy: reg prefer_male2 i.connect3 kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val  if d611ba2b11_id==3 & positions_common==1
outreg2 using client_main_rep, e(all) 

estpost tabstat prefer_male2 connected kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val if positions_common==1, s(count mean sd p50 min max) columns(statistics) 
esttab using descriptive2020.csv, replace cell((count mean sd p50 min max)) nonumber nomtitle

replace prefer_male = 0 if prefer_male == 1
replace prefer_male = -1 if prefer_male == 2
replace prefer_male = 1 if prefer_male == 3

svy: reg prefer_male connected kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val if positions_common==1




*****************2021 Results****************



* This dataset contains the survey data from the 2021 wave of PAPI
use Schuler_GenderAndClientelism_Replication2, replace /* This dataset contains the relevant variables from the 2021 PAPI survey*/

* This code sets the survey weights. The PSW_psweight_opt1 sets te respondent weights; other units adjust the standard errors for the clustered nature of the design. The post stratification weights account for the differences in provincial populations
svyset PSW_PSU [pweight=PSW_psweight], fpc(PSW_FPC1) strata(PSW_STRATA) singleunit(certainty) ///
 || PSW_SSU, fpc(PSW_FPC2) strata(PSW_STRATA2) || villageid, fpc(PSW_FPC3) strata(PSW_STRATA3) ///
 || _n,  poststrata(tinh)  postweight(PSW_province_population)
 


svy: reg prefer_male2 connected kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val if positions_common==1
estimates store y2021
outreg2 using client_main_rep, e(all) 

svy: reg prefer_male2 i.connect1 kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val  if d611ba2b11_id==1 & positions_common==1
outreg2 using client_main_rep, e(all) 

svy: reg prefer_male2 i.connect2 kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val  if d611ba2b11_id==2 & positions_common==1
outreg2 using client_main_rep, e(all) 

svy: reg prefer_male2 i.connect3 kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val  if d611ba2b11_id==3 & positions_common==1
outreg2 using client_main_rep, e(all) excel

* Figure 1
coefplot y2020 y2021,  keep(connected) ciopts(lwidth(thick)) msize(medlarge) xline(0, lcolor(red) lpattern(dash) lwidth(thick)) legend(rows(1) size(small) position(6) label(2 "2020") label(4 "2021")) xtitle("Preference for Male Legislator") title("") ylab("") xlab(-.01(.01).1, labsize(small))

replace prefer_male = 0 if prefer_male == 1
replace prefer_male = -1 if prefer_male == 2
replace prefer_male = 1 if prefer_male == 3

svy: reg prefer_male connected kinh female age party khuvuc income_pc education_pc papi_head_gender trad_val if positions_common==1

*****************2022 Figure 2****************
use Schuler_GenderAndClientelism_Replication3, replace /* This dataset contains the relevant variables from the 2022 PAPI survey*/

* connect1 is 1 if the randomized trait from Table 2 is Connection
* kinh =1 if respondent is from majority kinh ethnic group (0 if minority)
* female = 1 if respondent is a woman
* age_decade is respondent's age in decades
* khuvuc  is 1 if respondent is from urban area; 2 if from rural
* income_pc is a six category variable corresponding to 6 percentile groups of income
* education_pc is a four category variable corresponding to 4 quartiles of education_pc
* papi_head_gender is 1 if the village leader is a man and 2 if the respondent's village leader is a woman 

svy: reg connect1 kinh khuvuc female age_decade party  income_pc education_pc papi_head_gender
estimates store robust
coefplot  (robust, ciopts(lcolor(midblue)) mcolor(midblue) msize(small)),  graphregion(color(white)) xline(0) mlabsize(vsmall)  xtitle("Preference for Leader With Connections (0-1)") keep( female age_decade  khuvuc income_pc education_pc ) coeflabels( khuvuc = "Rural" female="Woman" age_decade= "Age (Decade)"  income_pc = "Income" education_pc= "Education" , wrap(20))

